<html>
<head><meta charset="utf-8"><title>grcov being weird.. · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/grcov.20being.20weird.2E.2E.html">grcov being weird..</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211006442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/grcov%20being%20weird../near/211006442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pm5k <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/grcov.20being.20weird.2E.2E.html#211006442">(Sep 23 2020 at 13:57)</a>:</h4>
<p>Hi, does anyone know why in certain instances grcov reports show a single closing bracket of a test function as uncovered (red)?</p>
<p>I've got a simple test which just says:</p>
<div class="codehilite"><pre><span></span><code>#[cfg(test)]
mod test_current_module {
    use super::*;
    #[test]
    #[should_panic(
        expected = &quot;Bad result!&quot;
    )]
    fn test_bad_res_panic() {
        func_that_can_panic(10);
    } // &lt;--- this is marked red and uncovered...?
}
</code></pre></div>


<p>The final closing bracket shows up as uncovered and I have no clue as to why? Appreciate any input..</p>



<a name="211008845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/grcov%20being%20weird../near/211008845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/grcov.20being.20weird.2E.2E.html#211008845">(Sep 23 2020 at 14:11)</a>:</h4>
<p>Well, the panic does lead to an _early_ return, of sorts, so the end of the function is never reached, even if that "end of function" is just "empty", _i.e._, <code>return ();</code>. I don't know, however, <code>grcov</code> well enough to know how to tweak it so that it ignores that "dead code"...</p>



<a name="211009385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/grcov%20being%20weird../near/211009385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pm5k <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/grcov.20being.20weird.2E.2E.html#211009385">(Sep 23 2020 at 14:15)</a>:</h4>
<p>Ah so it is considered unreachable code then.. I will have to investigate that one. Thanks, I think that's the bit I was missing. Guess 2 days of learning still means I know squat about Rust.. doh!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>